package com.light.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.light.common.validator.group.AddGroup;
import com.light.common.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 *
 * @author minmin
 * @email 980680541@gmail.com
 * @date 2024-07-15 21:42:34
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@NotNull(message = "修改时id不能为空！",groups = {UpdateGroup.class})
	@Null(message = "新增时id必须为空",groups = {AddGroup.class})
	private Long brandId;

	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空",groups = {AddGroup.class})
	private String name;

	/**
	 * 品牌logo地址
	 */
	@URL(message = "请输入合法的地址！",groups = {UpdateGroup.class,AddGroup.class})
	@NotBlank(message = "品牌logo地址不能为空",groups = {AddGroup.class})
	private String logo;

	/**
	 * 介绍
	 */
	@NotBlank(message = "介绍不能为空",groups = {AddGroup.class})
	private String descript;

	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态不能为空",groups = {AddGroup.class})
	@TableLogic(value = "1", delval = "0")
	private Integer showStatus;

	/**
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母不能为空",groups = {AddGroup.class})
	@Pattern(regexp = "^[A-Za-z]$", message = "检索首字母必须是一个字符且只能是A-Z或a-z",groups = {UpdateGroup.class,AddGroup.class})
	private String firstLetter;

	/**
	 * 排序
	 */
	@NotNull(message = "排序不能为空",groups = {AddGroup.class})
	@Min(value = 0, message = "排序必须是大于或等于0的数字",groups = {UpdateGroup.class,AddGroup.class})
	private Integer sort;
}
